/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Dao;


import Pojo.KhaNangCungUngPojo;
import Pojo.KhaNangCungUngPojo;
import java.sql.ResultSet;
import java.util.ArrayList;

/**
 *
 * @author VUHOANG
 */
public class KhaNangCungUngDao {
    public static ArrayList<KhaNangCungUngPojo>DSSanPhamTheoMaNCC(int mancc)
    {
        ArrayList<KhaNangCungUngPojo> ds=new ArrayList<KhaNangCungUngPojo>();
        try {
            String sql="select * from khanangcungung where MaNCC="+mancc;
            MySQLDataAccessHelper mysql=new MySQLDataAccessHelper();
            mysql.open();
            ResultSet rs=mysql.executeQuery(sql);            
            while(rs.next())
            {
                KhaNangCungUngPojo nv=new KhaNangCungUngPojo();
                 nv.setMaNCC(rs.getInt("MaNCC"));                
                nv.setMaSP(rs.getInt("MaSP")); 
                 nv.setTenSP(rs.getString("TenSP"));                             
              
                ds.add(nv);
            }
            mysql.close();
            
        } catch (Exception e) {
       System.out.println(e.getMessage());
        }
        return ds;        
    }  
    
}
